import request from '@/utils/http'
import requestSecond from '@/utils/http/httpSecond'

export class UserService {
  // 登录
  static login(params: Api.Auth.LoginParams) {
    return request.post<Api.Auth.LoginResponse>({
      url: '/api/auth/login',
      params
      // showErrorMessage: false // 不显示错误消息
    })
  }

  static loginSecond(params: Api.Auth.LoginParams) {
    return requestSecond.post<Api.Auth.LoginResponse>({
      url: '/apiSecond/auth/login',
      params
      // showErrorMessage: false // 不显示错误消息
    })
  }

  // 获取用户信息
  static getUserInfo() {
    return request.get<Api.User.UserInfo>({
      url: '/api/user/info'
      // 自定义请求头
      // headers: {
      //   'X-Custom-Header': 'your-custom-value'
      // }
    })
  }

  static getAnswer(data: { project_id: number; thinking_enable: boolean; search_enabled: boolean; session_id: number; prompt: { type: string; content: string }[] }) {
    return request.post<Api.User.GetAnswer>({
      url: '/api/v1/chat/completions'
    })
  }

  static getAnswerList() {
    return request.get<T>({
      url: '/api/public/v1/builder/job/list?ctoken=bigfish_ctoken_1a01c4di91&start=1&limit=10&projectId=1'
    })
  }

  // 获取用户列表
  static getUserList(params: Api.Common.PaginatingSearchParams) {
    return request.get<Api.User.UserListData>({
      url: '/api/user/list',
      params
    })
  }
}
